﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using Public;
using BLL;

namespace QLNhanKhau
{
    public partial class frmQuocTich : DevComponents.DotNetBar.Metro.MetroForm
    {
        public frmQuocTich()
        {
            InitializeComponent();
        }

        private void frmQuocTich_Load(object sender, EventArgs e)
        {
            dgvQuocTich.DataSource = null;
            dgvQuocTich.DataSource = QuocTichBLL.LoadQuocTich();

            QuocTichPublic qt = QuocTichBLL.LoadMaQT();
            txtMaQT.Text = (qt.MaQT + 1).ToString();

            txtMaQT.Enabled = false;
            int date = DateTime.Now.Day;
            int month = DateTime.Now.Month;
            int year = DateTime.Now.Year;

            //Ngay.Text = date.ToString() + "/" + month.ToString();
            Ngay.Text = DateTime.Now.ToShortDateString() ;
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            QuocTichPublic qt = new QuocTichPublic();
            qt.MaQT = byte.Parse(txtMaQT.Text);
            qt.TenQuocTich = txtQuocTich.Text;
            QuocTichBLL.InsertQuocTich(qt);
            frmQuocTich_Load(sender, e);
        }

    }
}
